package com.szx.usercenter.config;

import com.szx.usercenter.handle.TokenHandle;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author songzx
 * @date 2024/5/12
 * @apiNote
 */
@Configuration
public class TokenConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new TokenHandle())
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/sysUser/login",
                        "/sysUser/register",
                        "/sysUser/updatePassword",
                        "/swagger-ui.html",
                        "/swagger-ui/index.html",
                        "/swagger-resources",
                        "/v2/api-docs",
                        "/v2/api-docs-ext",
                        "/doc.html",
                        "/swagger-resources/configuration/ui",
                        "/swagger-resources/configuration/security",
                        "/swagger-resources/configuration/ui",
                        "/webjars/**",
                        "/swagger-resources/**",
                        "/pan/preview/**",
                        "/pan/downloadFile/**"
                );
    }
}
